<UserControl x:Class="wpf.SonosControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:wpf">
  <StackPanel DataContext="{Binding Path=Coordinator}">
    <ListView Focusable="False" IsEnabled="False" ItemsSource="{Binding Path=DataContext.Members, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TabItem}}, IsAsync=True}">
      <ListView.ItemTemplate>
        <DataTemplate>
          <TextBlock Text="{Binding Path=DeviceProperties.ZoneName}"/>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>
    <local:VolumeControl DataContext="{Binding IsAsync=True, Path=DataContext.Members, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TabItem}}}"/>
    <ProgressBar
      Minimum="0"
      Maximum="{Binding Mode=OneWay, Path=AVTransport.TrackDuration.TotalSeconds}"
      Value="{Binding Mode=OneWay, Path=AVTransport.RelTime.TotalSeconds}"/>
    <Button Content="{Binding IsAsync=True, Path=AVTransport.TransportState}" Command="MediaCommands.TogglePlayPause"/>
  </StackPanel>
  <UserControl.CommandBindings>
    <CommandBinding
      Command="MediaCommands.TogglePlayPause"
      Executed="MediaCommands_TogglePlayPause"
      CanExecute="MediaCommands_CanTogglePlayPause"/>
    <CommandBinding
      Command="MediaCommands.NextTrack"
      PreviewExecuted="MediaCommands_NextTrack"
      PreviewCanExecute="MediaCommands_CanNextTrack"/>
    <CommandBinding
      Command="MediaCommands.PreviousTrack"
      Executed="MediaCommands_PreviousTrack"
      CanExecute="MediaCommands_CanPreviousTrack"/>
    <CommandBinding
      Command="MediaCommands.MuteVolume"
      Executed="MediaCommands_MuteVolume"
      CanExecute="MediaCommands_CanMuteVolume"/>
    <CommandBinding
      Command="MediaCommands.Select"
      Executed="MediaCommands_Select"
      CanExecute="MediaCommands_CanSelect"/>
  </UserControl.CommandBindings>
</UserControl>
